/**
 * Yolema.com Inc.
 * Copyright (c) 2011-2012 All Rights Reserved.
 */
package org.grayrabbit.pay.chinapay.common;

/**
 * 银联常量信息
 * 
 * @author wy
 * @version $Id: PayConstant.java, v 0.1 2012-6-1 下午4:13:56 wy Exp $
 */
public class PayConstant {

    /**
     * ChinaPay交易状态码
     */
    public enum PAY_TRADE_TYPE {

        TRANS_TYPE_PAY("0001"), TRANS_TYPE_REFUND("0002");

        private String code;

        PAY_TRADE_TYPE(String code) {
            this.code = code;
        }

        public String getCode() {
            return this.code;
        }
        
        public static PAY_TRADE_TYPE get(String code){
            for(PAY_TRADE_TYPE ptt:PAY_TRADE_TYPE.values()){
                if(ptt.getCode().equals(code.trim())){
                    return ptt;
                }
            }
            return null;
        }

    }
    /**
     * 货币代码
     */
    public enum CURRENCY_CODE{
        
        RMB("156");
        
        private String code;

        CURRENCY_CODE(String code) {
            this.code = code;
        }

        public String getCode() {
            return this.code;
        } 
        
        public static CURRENCY_CODE get(String code){
            for(CURRENCY_CODE cc:CURRENCY_CODE.values()){
                if(cc.getCode().equals(code)){
                    return cc;
                }
            }
            return null;
        }
    }

}
